package topday1_9.chj;

import java.util.Scanner;

/**
 * @Auther:小陈的Java
 */
class RecursionDemo2 {
    public static int recursion (int n) {

        if (n==0||n==1)
            return 1;
        else{
            return n * recursion(n-1);
        }
    }
    public static void main(String[] args) {
        int n;
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入n的值");
        n = sc.nextInt();
        while(n<0) {
            System.out.println("输入有误，n要大于等于0哦");
            System.out.println("请再次输入");
            n = sc.nextInt();
            continue;
        }
        RecursionDemo2 recursion1= new RecursionDemo2();
        System.out.println("n!="+ recursion1.recursion(n));

    }
}
